        

        var harvestStore = new Ext.data.JsonStore({
			url: '/weihe/getSum_harvest',
			root: 'datas',
			fields : [{
						name:'HarvestId',mapping:'id'
					},{
     				    name:'HarvestDate', mapping:'date',type : 'date', dateFormat:"Y-m-d"
      			  	},{
						name:'HarvestIncome',mapping:'income'
					},{
						name:'HarvestCost',mapping:'cost'
					},{
						name:'HarvestFee',mapping:'fee'
				    },{
				    	name:'HarvestTax',mapping:'tax'
				    },{
				    	name:'HarvestBalance',mapping:'balance'
				    },{
				    	name:'HarvestOther',mapping:'other'
				    },{
				    	name:'HarvestLoss',mapping:'loss'
				    },{
				    	name:'HarvestGrossProfit',mapping:'grossProfit'
				    },{
				    	name:'HarvestSelfnet',mapping:'selfnet'
				    },{
				    	name:'HarvestActnet',mapping:'actnet'
				    },{
				    	name:'HarvestSale',mapping:'sale'
				    },{
				    	name:'HarvestActRate',mapping:'actRate'
				    },{
				    	name:'HarvestDiffPrice',mapping:'diffPrice'
				    },{
				    	name:'HarvestOincome',mapping:'oincome'
				    },{
				    	name:'HarvestOcost',mapping:'ocost'
				    },{
				    	name:'HarvestNet',mapping:'net'
				    },{
				    	name:'HarvestNetRate',mapping:'netRate'
				    },{
				    	name:'HarvestRate',mapping:'rate'
				    }],
					listeners :{ 
					   'beforeload':function(s,options) {
							var tag = 0;
							Ext.Ajax.request({
								url : '/weihe/getListJudge_harvest',
								success : function(response) {
									var json = Ext.decode(response.responseText);
									if (json.deny) {
										Ext.Msg.alert('错误',json.msg);
										tag = 1;
									}
										if(tag == 1){
											return false;
										}else{
											return true;						
										}
								},
								failure : function() {
									Ext.Msg.alert('错误', '失败!');
									tag =1;
								}
							});
			   }
			}
		});
        
   
    	

harvests = function(){
  return{
     
	
	 harvestGrid : function(){

		var rowSelectionModel = new Ext.grid.RowSelectionModel({singleSelect : true});
		
		 
	   var harvestGrid = new Ext.grid.GridPanel({
		   id:'harvestGrid',
		   title : '经营成果统计表',
		   region : 'center',
		   height :300,
		   stripeRows: true, 
		   minColumnWidth : 50,
		   tbar:["-",'查看年份:',new Ext.form.TextField({id:'year',name:'query',value:(new Date()).format('Y'),width:'50'}),new Ext.Button({text:'提交',handler : function() {
			   					Ext.getCmp("harvestGrid").getStore().baseParams = {'query':Ext.getCmp('year').getValue()};
			   					Ext.getCmp("harvestGrid").getStore().load({params : {start : 0, limit : 13}});
		   		}})
		   ,"-"],

		   loadMask : {msg:'正在加载数据，请稍侯...'},
		   store : harvestStore,
		   columns: [
		             {header : '日期', dataIndex : 'HarvestDate', menuDisabled : true,renderer:function(value, cellmeta, record, rowIndex){
							if(value != null){
									return value.format('Y年m月');
								}else{
									return "本年累计";
								}
		             }},
		             {header : '销售收入', dataIndex : 'HarvestIncome'},
		             {header : '销售成本', dataIndex : 'HarvestCost'},
		             {header : '费用', dataIndex : 'HarvestFee'},
		             {header : '税费', dataIndex : 'HarvestTax'},
		             {header : '财产损益(+-)', dataIndex : 'HarvestBalance'},
		             {header : '其他支出', dataIndex : 'HarvestOther'},
		             {header : '坏账损失', dataIndex : 'HarvestLoss'},
		             {header : '自营毛利', dataIndex : 'HarvestGrossProfit'},
		             {header : '自营纯利', dataIndex : 'HarvestSelfnet'},
		             {header : '自营纯利率(%)', dataIndex : 'HarvestRate'},
		             {header : '代理营业额', dataIndex : 'HarvestSale'},
		             {header : '代理费', dataIndex : 'HarvestActRate'},
		             {header : '中间差价', dataIndex : 'HarvestDiffPrice'},
		             {header : '代理纯利', dataIndex : 'HarvestActnet'},
		             {header : '其他业务收入', dataIndex : 'HarvestOincome'},
		             {header : '其他支出', dataIndex : 'HarvestOcost'},
		             {header : '总纯利', dataIndex : 'HarvestNet'},
		             {header : '总利率', dataIndex : 'HarvestNetRate'}
        ],
           sm : rowSelectionModel,
		   viewConfig : {
		     forceFit : false
		  }
});
		return harvestGrid;
	}
  }
}();








